struct SBTNode
{
	char dt;
	int bigram, size;
	struct SBTNode *lchild, *rchild;
};
typedef struct SBTNode SBTreeNode;

// Initialize a TreeSBTreeNode
SBTreeNode* initSBTreeNode(int bigram)
{
	SBTreeNode *tmp = malloc(sizeof(SBTreeNode));
	if (NULL == tmp)
		exit(1);
	tmp->dt = (char)0;
	tmp->bigram = bigram;
	tmp->size = 1;
	tmp->lchild = tmp->rchild = NULL;
	return tmp;
}

// get the size of the subtree
int getSize(SBTreeNode *node)
{
	if (NULL == node)
		return 0;
	else
		return node->size;
}

int getValueCount(SBTreeNode *node, char value)
{
	int ret = 0;
	if (NULL != node)
		ret = (node->dt == value) + getValueCount(node->lchild, value) + getValueCount(node->rchild, value);
	return ret;
}
